home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / updates / update29.zoo / gprof / diffs
Encoding:
Text File  |  1993-03-28  |  27.1 KB  |  1,134 lines

  1. ===================================================================
  2. RCS file: /net/acae127/home/bammi/etc/src/master/atari/gprof/Changelog,v
  3. retrieving revision 1.11
  4. diff -c -r1.11 Changelog
  5. *** 1.11    1992/08/14 17:19:16
  6. --- Changelog    1993/03/29 03:36:26
  7. ***************
  8. *** 72,74 ****
  9. --- 72,81 ----
  10.       clean up binary seach conditions in val_to_sym.
  11.   
  12.   ------------------------------- Patchlevel 9 ---------------------------
  13. + gprof.c: andreas
  14. +     Handle both st-out and gnu-out (from sym-ld) format.
  15. + cplusdem.c: andreas
  16. +     update
  17. + ------------------------------- Patchlevel 10 ---------------------------
  18. ===================================================================
  19. RCS file: /net/acae127/home/bammi/etc/src/master/atari/gprof/PatchLev.h,v
  20. retrieving revision 1.11
  21. diff -c -r1.11 PatchLev.h
  22. *** 1.11    1992/08/14 17:19:16
  23. --- PatchLev.h    1993/03/29 03:36:27
  24. ***************
  25. *** 1,4 ****
  26. ! #define    PatchLevel "09"
  27.   
  28.   /*
  29.    *    the Patch Level above is to identify the version
  30. --- 1,4 ----
  31. ! #define    PatchLevel "10"
  32.   
  33.   /*
  34.    *    the Patch Level above is to identify the version
  35. ===================================================================
  36. RCS file: /net/acae127/home/bammi/etc/src/master/atari/gprof/cplusdem.c,v
  37. retrieving revision 1.3
  38. diff -c -r1.3 cplusdem.c
  39. *** 1.3    1992/06/11 17:51:35
  40. --- cplusdem.c    1993/03/29 03:36:30
  41. ***************
  42. *** 23,29 ****
  43.   
  44.      Modified for g++ 1.90.06 (December 31 version).
  45.   
  46. !    Modified for g++ 1.95.03 (November 13 verison).  */
  47.   
  48.   /* This file exports one function
  49.   
  50. --- 23,29 ----
  51.   
  52.      Modified for g++ 1.90.06 (December 31 version).
  53.   
  54. !    Modified for g++ 1.95.03 (November 13 version).  */
  55.   
  56.   /* This file exports one function
  57.   
  58. ***************
  59. *** 148,154 ****
  60.     "co", "~",            /* ansi */
  61.     "call", "()",            /* old */
  62.     "cl", "()",            /* ansi */
  63. -   "cond", "?:",            /* old */
  64.     "alshift", "<<",        /* old */
  65.     "ls", "<<",            /* ansi */
  66.     "als", "<<=",            /* ansi */
  67. --- 148,153 ----
  68. ***************
  69. *** 172,177 ****
  70. --- 171,177 ----
  71.     "mx", ">?",            /* psuedo-ansi */
  72.     "min", "<?",            /* old */
  73.     "mn", "<?",            /* psuedo-ansi */
  74. +   "rm", "->*",            /* ansi */
  75.   };
  76.   
  77.   /* Beware: these aren't '\0' terminated. */
  78. ***************
  79. *** 235,240 ****
  80. --- 235,242 ----
  81.   {
  82.     int n = 0, success = 1;;
  83.     
  84. +   if (!isdigit (**type))
  85. +     return 0;
  86.     do
  87.       {
  88.         n *= 10;
  89. ***************
  90. *** 274,292 ****
  91.     if (*type++ != '_')
  92.       return NULL;
  93.   #endif
  94. !   p = type;
  95. !   while (*p != '\0' && !(*p == '_' && p[1] == '_'))
  96. !     p++;
  97. !   if (*p == '\0')
  98.       {
  99. !       /* destructor */
  100. !       if (type[0] == '_' && type[1] == CPLUS_MARKER && type[2] == '_')
  101.       {
  102. !       destructor = 1;
  103. !       p = type;
  104.       }
  105. !       /* virtual table "_vt$"  */
  106. !       else if (type[0] == '_' && type[1] == 'v' && type[2] == 't' && type[3] == CPLUS_MARKER)
  107.       {
  108.         int n = strlen (type + 4) + 14 + 1;
  109.         char *tem = (char *) xmalloc (n);
  110. --- 276,312 ----
  111.     if (*type++ != '_')
  112.       return NULL;
  113.   #endif
  114. !   /* destructor */
  115. !   if (type[0] == '_' && type[1] == CPLUS_MARKER && type[2] == '_')
  116. !     {
  117. !       destructor = 1;
  118. !       p = type;
  119. !     }
  120. !   /* virtual table "_vt$"  */
  121. !   else if (type[0] == '_' && type[1] == 'v' && type[2] == 't' && type[3] == CPLUS_MARKER)
  122.       {
  123. !       if (isdigit (type[4]))
  124.       {
  125. !       int n;
  126. !       string_init (&decl);
  127. !       type += 4;
  128. !       while (get_simple_count (&type, &n))
  129. !         {
  130. !           string_appendn (&decl, type, n);
  131. !           type += n;
  132. !           if (*type == '\0')
  133. !         {
  134. !           string_appendn (&decl, " virtual table", 15);
  135. !           return decl.b;
  136. !         }
  137. !           if (*type++ != CPLUS_MARKER)
  138. !         break;
  139. !           string_append (&decl, "::");
  140. !         }
  141. !       string_delete (&decl);
  142. !       return NULL;
  143.       }
  144. !       else
  145.       {
  146.         int n = strlen (type + 4) + 14 + 1;
  147.         char *tem = (char *) xmalloc (n);
  148. ***************
  149. *** 294,313 ****
  150.         strcat (tem, " virtual table");
  151.         return tem;
  152.       }
  153. !       /* static data member */
  154. !       else if (type[0] == '_' && type[1] != '_' && (strchr (type, CPLUS_MARKER) != NULL))
  155. !     {
  156. !       static_type = 1;
  157. !       p = type + 1;
  158. !     }
  159. !       else return NULL;
  160.       }
  161.   
  162.     string_init (&decl);
  163.   
  164.     if (static_type)
  165.       {
  166. !       if (!isdigit (p[0]) && ('t' != p[0]))
  167.       {
  168.         string_delete (&decl);
  169.         return NULL;
  170. --- 314,341 ----
  171.         strcat (tem, " virtual table");
  172.         return tem;
  173.       }
  174. !     }
  175. !   /* static data member */
  176. !   else if (type[0] == '_' && strchr ("0123456789Qt", type[1] != '_') != NULL
  177. !        && strchr (type, CPLUS_MARKER) != NULL)
  178. !     {
  179. !       static_type = 1;
  180. !       p = type + 1;
  181.       }
  182. +   else
  183. +     {
  184. +       p = type;
  185. +       while (*p != '\0' && !(*p == '_' && p[1] == '_'))
  186. +     p++;
  187. +       if (*p == '\0')
  188. +     return NULL;
  189. +     }
  190.   
  191.     string_init (&decl);
  192.   
  193.     if (static_type)
  194.       {
  195. !       if (!isdigit (p[0]) && ('t' != p[0]) && p[0] != 'Q')
  196.       {
  197.         string_delete (&decl);
  198.         return NULL;
  199. ***************
  200. *** 315,321 ****
  201.       }
  202.     else if (destructor)
  203.       {
  204. !       if (!isdigit (p[3])&& ('t' != p[3]))
  205.       {
  206.         string_delete (&decl);
  207.         return NULL;
  208. --- 343,349 ----
  209.       }
  210.     else if (destructor)
  211.       {
  212. !       if (!isdigit (p[3])&& ('t' != p[3]) && p[3] != 'Q')
  213.       {
  214.         string_delete (&decl);
  215.         return NULL;
  216. ***************
  217. *** 324,330 ****
  218.       }
  219.     else if (p == type)
  220.       {
  221. !       if (!isdigit (p[2]) && ('t' != p[2]))
  222.       {
  223.         p += 1;
  224.         while (*p != '\0' && !(*p == '_' && p[1] == '_'))
  225. --- 352,358 ----
  226.       }
  227.     else if (p == type)
  228.       {
  229. !       if (!isdigit (p[2]) && ('t' != p[2]) && p[2] != 'Q')
  230.       {
  231.         p += 1;
  232.         while (*p != '\0' && !(*p == '_' && p[1] == '_'))
  233. ***************
  234. *** 345,351 ****
  235.     else
  236.       {
  237.         string_appendn (&decl, type, p - type);
  238. !       decl.p[0] = '0';
  239.         munge_function_name (&decl);
  240.         p += 2;
  241.       }
  242. --- 373,379 ----
  243.     else
  244.       {
  245.         string_appendn (&decl, type, p - type);
  246. !       decl.p[0] = '\0';
  247.         munge_function_name (&decl);
  248.         p += 2;
  249.       }
  250. ***************
  251. *** 451,456 ****
  252. --- 479,486 ----
  253.           string_delete (&trawname);
  254.           break;
  255.         }
  256. +     if (tname.p[-1] == '>')
  257. +       string_append (&tname, " ");
  258.       string_append (&tname, ">::");
  259.       if (destructor)
  260.         string_append(&tname, "~");
  261. ***************
  262. *** 556,573 ****
  263.         int member;
  264.         switch (**type)
  265.       {
  266. -     case 'Q':
  267. -       n = (*type)[1] - '0';
  268. -       if (n < 0 || n > 9)
  269. -         {
  270. -           success = 0;
  271. -           break;
  272. -         }
  273. -       *type += 2;
  274. -       while (n-- > 0)
  275. -         do_type (type, result);
  276. -       break;
  277.       case 'P':
  278.         *type += 1;
  279.         string_prepend (&decl, "*");
  280. --- 586,591 ----
  281. ***************
  282. *** 610,629 ****
  283.   
  284.           member = **type == 'M';
  285.           *type += 1;
  286. !         if (!isdigit (**type))
  287. !           {
  288. !         success = 0;
  289. !         break;
  290. !           }
  291. !         n = 0;
  292. !         do
  293. !           {
  294. !         n *= 10;
  295. !         n += **type - '0';
  296. !         *type += 1;
  297. !           } 
  298. !         while (isdigit (**type));
  299. !         if (strlen (*type) < n)
  300.             {
  301.           success = 0;
  302.           break;
  303. --- 628,634 ----
  304.   
  305.           member = **type == 'M';
  306.           *type += 1;
  307. !         if (!get_simple_count (type, &n))
  308.             {
  309.           success = 0;
  310.           break;
  311. ***************
  312. *** 747,752 ****
  313. --- 752,765 ----
  314.           *non_empty = 1;
  315.         string_append (result, "unsigned");
  316.         break;
  317. +     case 'S':
  318. +       *type += 1;
  319. +       if (*non_empty)
  320. +         string_append (result, " ");
  321. +       else
  322. +         *non_empty = 1;
  323. +       string_append (result, "signed");
  324. +       break;
  325.       case 'V':
  326.         *type += 1;
  327.         if (*non_empty)
  328. ***************
  329. *** 813,818 ****
  330. --- 826,837 ----
  331.       string_append (result, " ");
  332.         string_append (result, "char");
  333.         break;
  334. +     case 'w':
  335. +       *type += 1;
  336. +       if (*non_empty)
  337. +     string_append (result, " ");
  338. +       string_append (result, "wchar_t");
  339. +       break;
  340.       case 'r':
  341.         *type += 1;
  342.         if (*non_empty)
  343. ***************
  344. *** 883,890 ****
  345.         if (!do_template_args (type, result))
  346.       success = 0;
  347.         else
  348. !     string_append (result, ">");
  349.         break;
  350.       default:
  351.         success = 0;
  352.         break;
  353. --- 902,947 ----
  354.         if (!do_template_args (type, result))
  355.       success = 0;
  356.         else
  357. !     {
  358. !       if (result->p[-1] == '>')
  359. !         string_append (result, " ");
  360. !       string_append (result, ">");
  361. !     }
  362. !       break;
  363. !     case 'Q':
  364. !       n = (*type)[1] - '0';
  365. !       if (n < 0 || n > 9)
  366. !     {
  367. !       success = 0;
  368. !       break;
  369. !     }
  370. !       *type += 2;
  371. !       if (n > 0)
  372. !     {
  373. !       string temp;
  374. !       if (!do_type (type, &temp))
  375. !         {
  376. !           success = 0;
  377. !           break;
  378. !         }
  379. !       if (*non_empty)
  380. !         string_append (result, " ");
  381. !       string_appends (result, &temp);
  382. !       string_delete (&temp);
  383. !       while (--n > 0)
  384. !         {
  385. !           if (!do_type (type, &temp))
  386. !         {
  387. !           success = 0;
  388. !           break;
  389. !         }
  390. !           string_append (result, "::");
  391. !           string_appends (result, &temp);
  392. !           string_delete (&temp);
  393. !         }
  394. !     }
  395.         break;
  396. +       
  397.       default:
  398.         success = 0;
  399.         break;
  400. ***************
  401. *** 916,922 ****
  402.       {
  403.         *type += 1;
  404.   
  405. !       success = do_type (type, &temp);
  406.         if (success)
  407.           string_appends (result, &temp);
  408.         string_delete(&temp);
  409. --- 973,979 ----
  410.       {
  411.         *type += 1;
  412.   
  413. !       success = do_arg (type, &temp);
  414.         if (success)
  415.           string_appends (result, &temp);
  416.         string_delete(&temp);
  417. ***************
  418. *** 932,938 ****
  419.         int is_integral = 0;
  420.         int done = 0;
  421.   
  422. !       success = do_type (type, &temp);
  423.         if (success)
  424.           string_appends (result, &temp);
  425.         string_delete(&temp);
  426. --- 989,995 ----
  427.         int is_integral = 0;
  428.         int done = 0;
  429.   
  430. !       success = do_arg (type, &temp);
  431.         if (success)
  432.           string_appends (result, &temp);
  433.         string_delete(&temp);
  434. ***************
  435. *** 948,953 ****
  436. --- 1005,1011 ----
  437.             done = is_pointer = 1;
  438.             break;
  439.           case 'C':    /* const */
  440. +         case 'S':    /* explicitly signed [char] */
  441.           case 'U':    /* unsigned */
  442.           case 'V':    /* volatile */
  443.           case 'F':    /* function */
  444. ***************
  445. *** 967,972 ****
  446. --- 1025,1031 ----
  447.           case 'i':    /* int */
  448.           case 's':    /* short */
  449.           case 'c':    /* char */
  450. +         case 'w':    /* wchar_t */
  451.             done = is_integral = 1;
  452.             break;
  453.           case 'r':    /* long double */
  454. ***************
  455. *** 1039,1046 ****
  456.       }
  457.         need_comma = 1;
  458.       }
  459. !     return success;
  460.   }
  461.   
  462.   /* `result' will be initialised in do_type; it will be freed on failure */
  463. --- 1098,1104 ----
  464.       }
  465.         need_comma = 1;
  466.       }
  467. !   return success;
  468.   }
  469.   
  470.   /* `result' will be initialised in do_type; it will be freed on failure */
  471. ===================================================================
  472. RCS file: /net/acae127/home/bammi/etc/src/master/atari/gprof/gprof.c,v
  473. retrieving revision 1.9
  474. diff -c -r1.9 gprof.c
  475. *** 1.9    1992/08/14 17:19:16
  476. --- gprof.c    1993/03/29 03:36:31
  477. ***************
  478. *** 49,54 ****
  479. --- 49,56 ----
  480.   
  481.   #ifdef atarist
  482.   #    include <st-out.h>
  483. + #    include <gnu-out.h>
  484. + #    define A_OUT
  485.   #else
  486.   #  if !defined(A_OUT) && !defined(MACH_O)
  487.   #    define A_OUT
  488. ***************
  489. *** 412,424 ****
  490.   /* argv[0], here for the sake of error messages.  */
  491.   char *myname = 0;
  492.   
  493. - /* Header of the executable file.  */
  494. - #ifdef atarist
  495. - struct aexec exec_header;
  496. - #else
  497. - struct exec exec_header;
  498. - #endif
  499.   /* Name of the executable file.  */
  500.   char *exec_file_name;
  501.   
  502. --- 414,419 ----
  503. ***************
  504. *** 429,439 ****
  505.   char *strs;
  506.   
  507.   #ifdef atarist
  508. ! /* The maximal length of an symbol name.
  509. !    This is initially eight, but will be changed to 22 in the code
  510.      if any GST compatible long symbols are detected in the symbol table.
  511.      NOTE: do not change it manually here */
  512. ! int max_atari_sym_length = 8;
  513.   #endif
  514.   
  515.   /* Header of the first gmon.out file we read.  This is used to (try to)
  516. --- 424,440 ----
  517.   char *strs;
  518.   
  519.   #ifdef atarist
  520. ! /* The maximal length of an symbol name (without leading underscore).
  521. !    This is initially seven, but will be changed to 21 in the code
  522.      if any GST compatible long symbols are detected in the symbol table.
  523.      NOTE: do not change it manually here */
  524. ! int max_atari_sym_length = 7;
  525. ! /* The format of the exec file.
  526. !    This is set to FALSE, if the exec file is in gnu-out format as produced
  527. !    by sym-ld.  It is checked when comparing symbols, which have limited
  528. !    length in the st-out format. */
  529. ! int atari_exec_format = TRUE;
  530.   #endif
  531.   
  532.   /* Header of the first gmon.out file we read.  This is used to (try to)
  533. ***************
  534. *** 634,642 ****
  535.   /* Prototypes for all the functions.  */
  536.   
  537.   int    main EXT2(int, char **);
  538. - #ifndef atarist
  539.   int    read_header_info EXT6 (char *, FILE *, long int *, unsigned int *,
  540.                      long int *, unsigned int *);
  541.   #endif
  542.   void    print_flat_profile EXT0();
  543.   void    print_call_graph EXT0();
  544. --- 635,645 ----
  545.   /* Prototypes for all the functions.  */
  546.   
  547.   int    main EXT2(int, char **);
  548.   int    read_header_info EXT6 (char *, FILE *, long int *, unsigned int *,
  549.                      long int *, unsigned int *);
  550. + #ifdef atarist
  551. + int    atari_read_header_info EXT4 (char *, FILE *, long int *,
  552. +                      unsigned int *);
  553.   #endif
  554.   void    print_flat_profile EXT0();
  555.   void    print_call_graph EXT0();
  556. ***************
  557. *** 653,663 ****
  558.   struct mesym **find_funp_from_name EXT1(char *);
  559.   struct mesym **find_funp_from_pointer EXT1(struct mesym *);
  560.   void    read_syms EXT2(FILE *, int);
  561.   struct mesym *val_to_sym EXT1(unsigned long);
  562. - #ifndef atarist
  563.   int    badsym EXT1(struct nlist *);
  564. ! #else
  565. ! int    badsym EXT1(struct asym *);
  566.   #endif
  567.   int    symcmp EXT2(const void *, const void *);
  568.   int    timecmp EXT2(const void *, const void *);
  569. --- 656,668 ----
  570.   struct mesym **find_funp_from_name EXT1(char *);
  571.   struct mesym **find_funp_from_pointer EXT1(struct mesym *);
  572.   void    read_syms EXT2(FILE *, int);
  573. + #ifdef atarist
  574. + void    atari_read_syms EXT2(FILE *, int);
  575. + #endif
  576.   struct mesym *val_to_sym EXT1(unsigned long);
  577.   int    badsym EXT1(struct nlist *);
  578. ! #ifdef atarist
  579. ! int    atari_badsym EXT1(struct asym *);
  580.   #endif
  581.   int    symcmp EXT2(const void *, const void *);
  582.   int    timecmp EXT2(const void *, const void *);
  583. ***************
  584. *** 752,758 ****
  585.     int    argc;
  586.     char    **argv;
  587.     int    c;
  588. -   int n;
  589.   
  590.     extern char *optarg;
  591.     extern int optind, opterr;
  592. --- 757,762 ----
  593. ***************
  594. *** 776,790 ****
  595.        
  596.     char *name = '\0';
  597.     int    ind;  
  598. - #ifndef atarist
  599.     long int syms_offset;
  600.     unsigned int syms_size;
  601.     long int strs_offset;
  602.     unsigned int strs_size;
  603. - #endif
  604.   
  605.   #ifdef atarist
  606. !   _malloczero(1);
  607.   #endif
  608.     argc=ac;
  609.     argv=av;
  610. --- 780,792 ----
  611.        
  612.     char *name = '\0';
  613.     int    ind;  
  614.     long int syms_offset;
  615.     unsigned int syms_size;
  616.     long int strs_offset;
  617.     unsigned int strs_size;
  618.   
  619.   #ifdef atarist
  620. !   /* _malloczero(1); */
  621.   #endif
  622.     argc=ac;
  623.     argv=av;
  624. ***************
  625. *** 870,894 ****
  626.     /* Open the a.out file, and read in selected portions */
  627.   #ifdef atarist
  628.     fp=ck_fopen (exec_file_name, "rb");
  629. !   ck_fread ((void *)&exec_header, sizeof (exec_header), 1, fp);
  630. !   /* Make sure its really an a.out file.  If it isn't yell and scream
  631. !      and stamp our feet. */
  632. !   if (A_BADMAG (exec_header))
  633. !     fatal ("`%s' is not an executable file", exec_file_name);
  634. !   if(exec_header.a_syms == 0L)
  635. !     fatal ("`%s' has no symbols", exec_file_name);
  636. !   /* Read the symbols, and put the interesting ones (sorted) in SYMS.  */
  637. !   /* read_syms builds strs too */
  638. !   ck_fseek (fp, A_SYMOFF (exec_header), 0);
  639. !   read_syms (fp, exec_header.a_syms/sizeof (struct asym));
  640. ! #else /* ! atarist */
  641. !   /* Open the a.out file, and read in selected portions */
  642.     fp=ck_fopen (exec_file_name, "r");
  643.   
  644.     /* Make sure its really an a.out file.  If it isn't yell and scream
  645.        and stamp our feet. */
  646. --- 872,893 ----
  647.     /* Open the a.out file, and read in selected portions */
  648.   #ifdef atarist
  649.     fp=ck_fopen (exec_file_name, "rb");
  650. ! #else
  651.     fp=ck_fopen (exec_file_name, "r");
  652. + #endif
  653. + #ifdef atarist
  654. +   if (atari_read_header_info (exec_file_name, fp, &syms_offset, &syms_size))
  655. +     {
  656. +       /* Read the symbols, and put the interesting ones (sorted) in SYMS.  */
  657. +       /* read_syms builds strs too */
  658. +       ck_fseek (fp, syms_offset, 0);
  659. +       atari_read_syms (fp, syms_size / sizeof (struct asym));
  660. +     }
  661. +   else
  662. +     {
  663. +       atari_exec_format = FALSE;
  664. + #endif /* atarist */
  665.   
  666.     /* Make sure its really an a.out file.  If it isn't yell and scream
  667.        and stamp our feet. */
  668. ***************
  669. *** 903,908 ****
  670. --- 902,910 ----
  671.     /* Read the symbols, and put the interesting ones (sorted) in SYMS.  */
  672.     ck_fseek (fp, syms_offset, 0);
  673.     read_syms (fp, syms_size / sizeof (struct nlist));
  674. + #ifdef atarist
  675. +   }
  676.   #endif /* atarist */
  677.   
  678.     ck_fclose (fp);
  679. ***************
  680. *** 987,993 ****
  681.     return(0);
  682.   }
  683.   
  684. - #ifndef atarist
  685.   /* Read various information from the header of an object file.
  686.      Return 0 for failure or 1 for success.  */
  687.   
  688. --- 989,994 ----
  689. ***************
  690. *** 1062,1068 ****
  691.   
  692.     return 0;
  693.   }
  694. ! #endif /* !atarist */
  695.   
  696.   /* Output a summary gmon file containing all our accumulated
  697.      histogram and call-graph data.  */
  698. --- 1063,1092 ----
  699.   
  700.     return 0;
  701.   }
  702. ! #ifdef atarist
  703. ! int
  704. ! atari_read_header_info (name, fp, syms_offset, syms_size)
  705. !      char *name;
  706. !      FILE *fp;
  707. !      long int *syms_offset;
  708. !      unsigned int *syms_size;
  709. ! {
  710. !   struct aexec hdr;
  711. !   ck_fseek (fp, 0L, 0);
  712. !   if (fread ((char *) &hdr, sizeof hdr, 1, fp) == 1 && !A_BADMAG(hdr))
  713. !     {
  714. !       *syms_offset = A_SYMOFF (hdr);
  715. !       *syms_size = hdr.a_syms;
  716. !       return 1;
  717. !     }
  718. !   return 0;
  719. ! }
  720. ! #endif /* atarist */
  721.   
  722.   /* Output a summary gmon file containing all our accumulated
  723.      histogram and call-graph data.  */
  724. ***************
  725. *** 1718,1724 ****
  726.   #ifndef atarist
  727.         if (!strcmp (p->name, filters[n].name)) {
  728.   #else
  729. !       if (!strncmp (p->name, filters[n].name, max_atari_sym_length)) {
  730.   #endif
  731.           tothist-=p->histo;
  732.           break;
  733. --- 1742,1750 ----
  734.   #ifndef atarist
  735.         if (!strcmp (p->name, filters[n].name)) {
  736.   #else
  737. !       if (atari_exec_format
  738. !           ? !strncmp (p->name, filters[n].name, max_atari_sym_length)
  739. !           : !strcmp (p->name, filters[n].name)) {
  740.   #endif
  741.           tothist-=p->histo;
  742.           break;
  743. ***************
  744. *** 2090,2097 ****
  745.     return 0;
  746.   }
  747.   
  748. - #ifndef atarist /* atarist specific version at end */
  749.   /* Read symbols from a.out file open on FP.  There are N of them.  Allocate a
  750.      vector to store the interesting ones in, and sort it numerically.  */
  751.   
  752. --- 2116,2121 ----
  753. ***************
  754. *** 2130,2135 ****
  755. --- 2154,2165 ----
  756.     for (sym= &tmpsyms[0], i=0; sym<&tmpsyms[n]; sym++) {
  757.       if (!badsym (sym)) {
  758.         syms[i].name=sym->n_un.n_name;
  759. + #ifndef nounderscore
  760. +       /* Remove the initial _ from the symbol name */
  761. +       if (*(syms[i].name)=='_')
  762. +     syms[i].name++;
  763. + #endif
  764.         syms[i].value=sym->n_value;
  765.         i++;
  766.       }
  767. ***************
  768. *** 2144,2149 ****
  769. --- 2174,2253 ----
  770.     qsort (syms, nsym, sizeof (struct mesym), symcmp);
  771.     free ((void *)tmpsyms);
  772.   }
  773. + #ifdef atarist
  774. + void
  775. + atari_read_syms FUN2(FILE *, fp, int, n)
  776. + {
  777. +   struct asym *tmpsyms;
  778. +   struct asym *sym;
  779. +   char *s, *p, *q;
  780. +   int i, j, is_long;
  781. +   /* creat space for incore name strings */
  782. +   s = strs = ck_malloc (n*sizeof (struct asym)); /* slight overkill */
  783. +   *s++ = 0;            /* so that sym.name[-1] is always defined */
  784. +   /* Read the entire symbol table.  */
  785. +   tmpsyms=(struct asym *)ck_malloc (n*sizeof (struct asym));
  786. +   ck_fread (tmpsyms, sizeof (struct asym), n, fp);
  787. +   /* Count the useful symbols.
  788. +      Also relocate their name-fields to be C string pointers.  */
  789. +   for (sym= &tmpsyms[0], i=0; sym<&tmpsyms[n]; sym++) {
  790. +     q = s;
  791. +     for (j = 0, p = sym->n_un.a_name; (j < 8) && (*p != '\0'); j++) 
  792. +       *s++ = *p++;
  793. +     if ((sym->a_type & A_LNAM) == A_LNAM) {
  794. +       max_atari_sym_length = 21;
  795. +       is_long = TRUE;
  796. +       if (sym + 1 < &tmpsyms[n]) {
  797. +     for (j = 0, p = sym[1].n_un.a_name; j < 14 && *p != '\0'; j++)
  798. +       *s++ = *p++;
  799. +       }
  800. +       else
  801. +     /* there's something wrong; assume short symbol */
  802. +     is_long = FALSE;
  803. +     }
  804. +     else
  805. +       is_long = FALSE;
  806. +     *s++ = '\0';
  807. +     sym->n_un.ptr = q;
  808. +     if (atari_badsym (sym))
  809. +       sym->n_un.ptr = NULL;
  810. +     else
  811. +       i++;
  812. +     if (is_long)
  813. +       /* skip symbol name extension */
  814. +       (++sym)->n_un.ptr = NULL;
  815. +   }
  816. +   /* Allocate permanent space and copy useful symbols into it.  */
  817. +   nsym=i;
  818. +   syms=(struct mesym *)ck_calloc (nsym, sizeof (struct mesym));
  819. +   for (sym= &tmpsyms[0], i=0; sym<&tmpsyms[n]; sym++) {
  820. +     if (sym->n_un.ptr != NULL) {
  821. +       syms[i].name=sym->n_un.ptr;
  822. + #ifndef nounderscore
  823. +       /* Remove the initial _ from the symbol name */
  824. +       if (*(syms[i].name)=='_')
  825. +     syms[i].name++;
  826. + #endif
  827. +       syms[i].value=sym->a_value;
  828. +       i++;
  829. +     }
  830. +   }
  831. +   if (i != nsym)
  832. +     exit (96);
  833. +   /* Put symbols in numeric order.  */
  834. +   qsort (syms, nsym, sizeof (struct mesym), symcmp);
  835. +   free ((void *)tmpsyms);
  836. + }
  837.   #endif /* atarist */
  838.   
  839.   /* Return the symbol which has the largest value less than or equal to VAL.
  840. ***************
  841. *** 2177,2183 ****
  842.     return m;
  843.   }
  844.   
  845. - #ifndef atarist
  846.   /* Return TRUE if the nlist-entry SYM describes a symbol
  847.      that gprof should NOT pay attention to.  */
  848.   
  849. --- 2281,2286 ----
  850. ***************
  851. *** 2193,2199 ****
  852.       return TRUE;
  853.   #endif
  854.     local = !(sym->n_type&N_EXT);
  855. !   if (no_locals && !local)
  856.       return TRUE;
  857.     /* Filenames or pascal labels should be ignored */
  858.   if (local
  859. --- 2296,2302 ----
  860.       return TRUE;
  861.   #endif
  862.     local = !(sym->n_type&N_EXT);
  863. !   if (no_locals && local)
  864.       return TRUE;
  865.     /* Filenames or pascal labels should be ignored */
  866.   if (local
  867. ***************
  868. *** 2206,2212 ****
  869. --- 2309,2342 ----
  870.       return TRUE;
  871.     return FALSE;
  872.   }
  873. + #ifdef atarist
  874. + /* Return TRUE if the asym-entry SYM describes a symbol
  875. +    that gprof should NOT pay attention to.  */
  876. + int
  877. + atari_badsym FUN1(struct asym *, sym)
  878. + {
  879. +   int local;
  880. +   if (!(sym->a_type & A_TEXT))
  881. +     return TRUE;
  882. +   local = !(sym->a_type & A_GLOBL);
  883. +   if (no_locals && local)
  884. +     return TRUE;
  885. +   /* Filenames or pascal labels should be ignored */
  886. +   if (local
  887. +       && (index (sym->n_un.ptr, '.') || index (sym->n_un.ptr, '$')
  888. +       || index (sym->n_un.ptr, '/') || index (sym->n_un.ptr, '\\')
  889. +       || index (sym->n_un.ptr, ':')
  890. + #ifndef nounderscore
  891. +       || sym->n_un.ptr[0] != '_'
  892.   #endif
  893. +       ))
  894. +     return TRUE;
  895. +   return FALSE;
  896. + }
  897. + #endif /* atarist */
  898.   
  899.   /* This is used to qsort () the symbol table into numerical order. */
  900.   
  901. ***************
  902. *** 2829,2846 ****
  903.   
  904.     n=0;
  905.     for (np=syms, endp= &syms[nsym]; np<endp; np++) {
  906. -   char *demangled = cplus_demangle (np->name);
  907. -   char *name;
  908. -     if (demangled)
  909. -       name = demangled;
  910. -     else {
  911. -       name = np->name;
  912.   #ifndef nounderscore
  913. !       if (*name == '_')
  914. !     name++;
  915.   #endif
  916. !     }
  917.       
  918.       sprintf (buf, "%-15s %#6lx %d %2d.%2d[%d]",
  919.            name, np->value, np->histo, np->ncalled, np->ncalls, np->cycnum);
  920. --- 2959,2971 ----
  921.   
  922.     n=0;
  923.     for (np=syms, endp= &syms[nsym]; np<endp; np++) {
  924.   #ifndef nounderscore
  925. !     char *demangled = cplus_demangle (np->name);
  926. ! #else
  927. !     char *demangled =
  928. !       cplus_demangle (np->name[-1] == '_' ? np->name-1 : np->name);
  929.   #endif
  930. !     char *name = demangled == NULL ? np->name : demangled;
  931.       
  932.       sprintf (buf, "%-15s %#6lx %d %2d.%2d[%d]",
  933.            name, np->value, np->histo, np->ncalled, np->ncalls, np->cycnum);
  934. ***************
  935. *** 2877,2991 ****
  936.     }
  937.   }
  938.   
  939. - #ifdef atarist    /* atariSt specific versions */
  940. - /* Return TRUE if the asym-entry SYM describes a symbol
  941. -    that gprof should NOT pay attention to.  */
  942. - #define ISDRIVE(d) ( \
  943. -     (((d) >= 'A') && ((d) <= 'Z')) || \
  944. -         (((d) >= 'a') && ((d) <= 'z'))    )
  945. - int
  946. - badsym FUN1(struct asym *, sym)
  947. - {
  948. -   if(sym->a_type == A_UNDF)
  949. -     return TRUE;  /* these are the symbols ld (write_atari_sym()) had faked */
  950. -   if (!(sym->a_type & A_TEXT))
  951. -     return TRUE;
  952. -   if (no_locals && !(sym->a_type & A_GLOBL))
  953. -     return TRUE;
  954. -   if(!strncmp(sym->n_un.ptr, "gcc_comp", 8L))
  955. -     return TRUE;
  956. -   if(ISDRIVE((sym->n_un.ptr)[0]) && ((sym->n_un.ptr)[1] == ':'))
  957. -    return TRUE;
  958. -   /* Filenames or pascal labels should be ignored */
  959. -   if (index (sym->n_un.ptr, '.') || index (sym->n_un.ptr, '$') ||
  960. -       index (sym->n_un.ptr, '/') || index (sym->n_un.ptr, '\\')  )
  961. -     return TRUE;
  962. -   return FALSE;
  963. - }
  964. - /* Read symbols from a.out file open on FP.  There are N of them.  Allocate a
  965. -    vector to store the interesting ones in, and sort it numerically.  */
  966. - void
  967. - read_syms FUN2(FILE *, fp, int, n)
  968. - {
  969. -   struct asym *tmpsyms;
  970. -   char *s, *p, *q;
  971. -   int i,j,is_long;
  972. -   
  973. -   /* creat space for incore name strings */
  974. -   s = strs = ck_malloc(n*25); /* slight overkill */
  975. -   /* Read the entire symbol table.  */
  976. -   tmpsyms=(struct asym *)ck_malloc (n*sizeof (struct asym));
  977. -   ck_fread (tmpsyms, sizeof (struct asym), n, fp);
  978. -    
  979. -   /* Count the useful symbols.
  980. -      Also relocate their name-fields to be C string pointers.  */
  981. -   for(nsym = 0, i = 0; i < n; i++)
  982. -   {
  983. -       for(j = 0, p = &(tmpsyms[i].n_un.a_name[0]), q = s;
  984. -       (j < 8) && (*p != '\0'); j++) 
  985. -       *s++ = *p++;
  986. -       if ((tmpsyms[i].a_type & A_LNAM) == A_LNAM)
  987. -     {
  988. -       max_atari_sym_length = 22;
  989. -       is_long = TRUE;
  990. -       if (i + 1 < n)
  991. -         for (j = 0, p = &tmpsyms[i+1].n_un.a_name[0];
  992. -          j < 14 && *p != '\0'; j++)
  993. -           *s++ = *p++;
  994. -       else
  995. -         /* there's something wrong; assume short symbol */
  996. -         is_long = FALSE;
  997. -     }
  998. -       else
  999. -     is_long = FALSE;
  1000. -       *s++ = '\0';
  1001. -       tmpsyms[i].n_un.ptr = q;
  1002. -       if (badsym (&tmpsyms[i]))
  1003. -       {
  1004. -       tmpsyms[i].n_un.ptr = (char *)0;
  1005. -       }
  1006. -       else
  1007. -       {
  1008. -       nsym++;
  1009. -       }
  1010. -       if (is_long)
  1011. -     /* skip symbol name extension */
  1012. -     tmpsyms[++i].n_un.ptr = NULL;
  1013. -   }
  1014. -   
  1015. -   /* Allocate permanent space and copy useful symbols into it.  */
  1016. -   syms=(struct mesym *)ck_calloc (nsym, sizeof (struct mesym));
  1017. -   for (i=0, j = 0; i < n; i++) {
  1018. -     if (tmpsyms[i].n_un.ptr != (char *)0) {
  1019. -       syms[j].name = tmpsyms[i].n_un.ptr;
  1020. - /* #ifndef nounderscore */
  1021. - #if 0
  1022. -       /* Remove the initial _ from the symbol name */
  1023. -       if (*(syms[j].name)=='_')
  1024. -     syms[j].name++;
  1025. - #endif
  1026. -       syms[j].value = tmpsyms[i].a_value;
  1027. -       j++;
  1028. -     }
  1029. -   }
  1030. -   if (j != nsym)
  1031. -     exit (99);
  1032. -   free ((void *)tmpsyms);
  1033. -   /* Put symbols in numeric order.  */
  1034. -   qsort (syms, nsym, sizeof (struct mesym), symcmp);
  1035. - }
  1036. - #endif /* atarist */
  1037.   void print_version FUN0()
  1038.   {
  1039.   #ifdef atarist
  1040. --- 3002,3007 ----
  1041. ***************
  1042. *** 3018,3046 ****
  1043.   void
  1044.   fprint_name FUN2(FILE *, stream, char *, name)
  1045.   {
  1046.     char *demangled = cplus_demangle (name);
  1047. !   if (demangled == NULL)
  1048. !   {
  1049. ! #ifndef nounderscore
  1050. !       if (*name == '_')
  1051. !     name++;
  1052.   #endif
  1053. !       fputs (name, stream);
  1054. !   }
  1055.     else
  1056.       {
  1057.         fputs (demangled, stream);
  1058.         free (demangled);
  1059.       }
  1060.   }
  1061. - #if 0
  1062. - /* let this be dummy for now, 
  1063. -    if you want to throw in the cplusplus name demangler, simple
  1064. -    delete this function, and link with cplus-dem.o
  1065. - */
  1066. - char *cplus_demangle FUN1(char *, name)
  1067. - {
  1068. -   return NULL;
  1069. - }
  1070. - #endif
  1071. --- 3034,3049 ----
  1072.   void
  1073.   fprint_name FUN2(FILE *, stream, char *, name)
  1074.   {
  1075. + #ifdef nounderscore
  1076.     char *demangled = cplus_demangle (name);
  1077. ! #else
  1078. !   char *demangled = cplus_demangle (name[-1] == '_' ? name-1 : name);
  1079.   #endif
  1080. !   if (demangled == NULL)
  1081. !     fputs (name, stream);
  1082.     else
  1083.       {
  1084.         fputs (demangled, stream);
  1085.         free (demangled);
  1086.       }
  1087.   }
  1088.